fn lines_match(expected: &str, mut actual: &str) -> bool {
for part in expected.split_str("[..]") {
match actual.find_str(part) {
- Some(i) => actual = actual.slice_from(i),
+ Some(i) => actual = actual.slice_from(i + part.len()),
None => {
return false
}
}
}
- return true;
+ actual.len() == 0 || expected.ends_with("[..]")
}
struct ZipAll<T, I1, I2> {
assert_that(p.process(cargo_dir().join("cargo")).arg("bench"),
execs().with_stdout(format!("\
{} foo v0.5.0 ({})
-{} target[..]release[..]foo
+{} target[..]release[..]foo-[..]
running 1 test
test bench_hello ... bench: 0 ns/iter (+/- 0)
assert_that(p.process(cargo_dir().join("cargo")).arg("bench"),
execs().with_stdout(format!("\
{} foo v0.5.0 ({})
-{} target[..]release[..]foo
+{} target[..]release[..]foo-[..]
running 1 test
test bench_hello ... ",
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
-{running} target[..]release[..]foo
+{running} target[..]release[..]foo-[..]
running 1 test
test lib_bench ... bench: 0 ns/iter (+/- 0)
execs().with_status(0)
.with_stdout(format!("\
{compiling} foo v0.0.1 ({dir})
-{running} target[..]release[..]foo
+{running} target[..]release[..]foo-[..]
running 1 test
test bar ... bench: 0 ns/iter (+/- 0)
execs().with_status(0)
.with_stdout(format!("\
{compiling} foo v0.0.1 ({dir})
-{running} target[..]release[..]foo
+{running} target[..]release[..]foo-[..]
running 1 test
test foo ... bench: 0 ns/iter (+/- 0)
.with_stderr("\
[..]warning: function is never used: `dead`[..]
[..]fn dead() {}
-
+[..]^~~~~~~~~~~~
"));
assert_that(&p.bin("foo"), existing_file());
assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(format!("\
warning: the old build command has been deprecated\n\
-Failed to run custom build command for `foo v0.5.0 ({dir})
+Failed to run custom build command for `foo v0.5.0 ({dir})`
Process didn't exit successfully: `{}` (status=101)\n\
--- stderr\n\
task '<main>' panicked at 'nope', {filename}:2\n\
assert_that(p.cargo_process("build"),
execs().with_status(101).with_stderr(format!("\
warning: the old build command has been deprecated\n\
-Failed to run custom build command for `foo v0.5.0 ({dir})
+Failed to run custom build command for `foo v0.5.0 ({dir})`
Process didn't exit successfully: `{}` (status=101)\n\
--- stderr\n\
task '<main>' panicked at 'nope', {filename}:2\n\
assert_that(p.cargo_process("publish").arg("-v").arg("--no-verify"),
execs().with_status(101).with_stderr("\
-all dependencies must come from the same registry
+all dependencies must come from the same registry.
dependency `foo` comes from git://path/to/nowhere instead
"));
})
assert_that(p.cargo_process("publish"),
execs().with_status(101).with_stderr("\
all path dependencies must have a version specified when being uploaded \
-to the registry
+to the registry.
dependency `bar` does not specify a version
"));
})
assert_that(p.process(cargo_dir().join("cargo")).arg("test"),
execs().with_stdout(format!("\
{} foo v0.5.0 ({})
-{} target[..]foo
+{} target[..]foo-[..]
running 1 test
test test_hello ... ok
assert_that(p.process(cargo_dir().join("cargo")).arg("test"),
execs().with_stdout(format!("\
{} foo v0.5.0 ({})
-{} target[..]foo
+{} target[..]foo-[..]
running 1 test
test test_hello ... FAILED
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-{running} target[..]foo
+{running} target[..]foo[..]
running 1 test
test lib_test ... ok
execs().with_status(0)
.with_stdout(format!("\
{compiling} foo v0.0.1 ({dir})
-{running} target[..]foo
+{running} target[..]foo-[..]
running 1 test
test bar ... ok
execs().with_status(0)
.with_stdout(format!("\
{compiling} foo v0.0.1 ({dir})
-{running} target[..]foo
+{running} target[..]foo-[..]
running 1 test
test foo ... ok